<?php
	require_once($_SERVER["DOCUMENT_ROOT"]."/global.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/security_mod.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/level_mod.php");

	SecurityMod::login();

	$level = $_SESSION["account"]->getLevel();
	if ($level != 'Admin')
		SecurityMod::logout();

	// check if there is a validation code
	if (!v($_REQUEST, "validation")) {
		header('location: accounts.php');
		exit;
	}

	$acc = AccountMod::getAccount(v($_REQUEST, "name"));
        $validation = v($_REQUEST, "validation");
	AccountMod::updateValidation($acc->getName(), $validation);

	header('location: accounts.php');
?>
